<%@ page language="java" contentType="text/html; charset=UTF-8"    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec"    uri="http://www.springframework.org/security/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<sec:authentication property="principal" var="currentPrincipal" scope="page" />

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>

</head>

<body class="ms-theme-blue">

  <%@ include file="/WEB-INF/include/header.jsp"%>
  <%@ include file="/WEB-INF/include/submenu.jsp"%>
  
  <div class="container-fluid ms-container has-ms-sidemenu">
    
    <ol class="ms-breadcrumb breadcrumb">
      <li class="active">运输业务管理-外包指令派车</li>
    </ol>
    
    <div class="ms-content-layout">
      
	    <div class="ms-operation-bar no-margin no-bottom-border clearfix">
	      <div class="ms-operation-group pull-right">
	        <a href="${ctx.host}/out-shipments/dispatch" data-target="#dispatching-confirm" data-toggle="modal" class="btn ms-btn ms-btn-blue btn-dispatch">
	          <i class="glyphicon glyphicon-check"></i>&nbsp;&nbsp;确认派车
	        </a>
	      </div>
	    </div>
      
      <table class="table table-hover ms-table">
        <thead>
          <tr>
            <th><input type="checkbox" id="select-all" /></th>
            <th>安吉调度指令号</th>
            <th>调度指令组号</th>
            <th>承运商</th>
            <th>日期</th>
            <th>起始地</th>
            <th>目的地</th>
            <th>驳运车号</th>
            <th>装车道号</th>
            <th>调度数量</th>
            <th>商品车类型</th>
            <th>预计装运时间</th>
            <th>预计起运时间</th>
          </tr>
        </thead>
        
        <tbody>
          <c:forEach items="${shipments}" var="shipment">
            <tr>
              <td><input type="checkbox" name="loadNumber" value="${shipment.shipmentNumber}"></td>
              <td>${shipment.shipmentNumber}</td>
              <td>${shipment.shipmentGroup}</td>
              <td>${empty shipment.transCorpId ? '': persist.organization(shipment.transCorpId).name}</td>
              <td><fmt:formatDate value="${shipment.createTime}" pattern="yyyy-MM-dd"/></td>
              <td>${empty shipment.srcWhId ? '' : ( persist.warehouse(shipment.srcWhId).code ).concat( '-' ).concat( persist.warehouse(shipment.srcWhId).name )}</td>
              <td>${empty shipment.destWhId ? '' : ( persist.warehouse(shipment.destWhId).code ).concat( '-' ).concat( persist.warehouse(shipment.destWhId).name )}</td>
              <td>${empty shipment.transMeansId ? '' : ( persist.vehicle(shipment.transMeansId).code ).concat( '-' ).concat( persist.vehicle(shipment.transMeansId).name )}</td>
              <td>${shipment.driveWay}</td>
              <td>${shipment.loadQuantity}</td>
              <td>${shipment.carSummary} </td>
              <td><fmt:formatDate value="${shipment.loadingTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
              <td><fmt:formatDate value="${shipment.leavingTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
            </tr>
          </c:forEach>
        </tbody>
        
        <tfoot>
          <tr>
            <td colspan="13" class="no-vertical-padding">
              <div class="pull-left">
                <jsp:include page="/WEB-INF/include/page.jsp">
                  <jsp:param name="url" value="${ctx.host}/out-shipments?dispatch=ture" />
                  <jsp:param name="queryString" value="${queryString}" />
                </jsp:include>
              </div>
              
              <div class="pull-right">
                <c:if test="${page.totals > 0}">
                  <a href="${ctx.host}/out-shipments/export-shipment?${queryString}&per_page=${config.everyPage}&page=${page.currentPage}" class="btn btn-default ms-export">输出当前记录</a>
                  <a href="${ctx.host}/out-shipments/export-all-shipment?${queryString}&limit=${config.limit}" class="btn btn-default ms-export">输出所有记录</a>
                </c:if>
              </div>
            </td>
          </tr>
        </tfoot>
        
      </table>

    </div> 
  </div>       
  
  <%@ include file="/WEB-INF/include/script.jsp"%>
  <d:resource type="script" root="${ctx.resource}/build" src="js/page/business/out-shipment/out-shipment-dispatch-list.js"/>
  <script type="text/javascript">
    require(['page/business/out-shipment/out-shipment-dispatch-list'], function (page) {
      page.init();
    });
  </script>
  
</body>
</html>